from flask import json


class JsonResponse(object):

    def __init__(self, success, data):
        self.success = success
        self.data = data

    def to_json(self):
        return json.dumps(self, default=lambda o: o.__dict__,
                          sort_keys=True)
